{extend name="public/world"}
{block name="title"}添加商品{/block}
{block name="style"}
<style type="text/css">

</style>
{/block}
{block name="container"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
    <div class="layui-card" style="padding:20px 0 0 0;height:425px;">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">商品名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="" lay-verify="required" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">规格说明</label>
                <div class="layui-input-inline">
                    <input type="text" name="norm" value="" placeholder="请输入规格说明" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">物料组</label>
                <div class="layui-input-inline">
                    <input type="text" name="tid" id="tree_name" lay-filter="tree_name"  value="" lay-verify="required" placeholder="请选择物料组" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">销售单位</label>
                <div class="layui-input-inline">
                    <select name="unit" lay-verify="required" lay-search>
                        <option value="">请选择</option>
                        {volist name="units" id="unit"}
                        <option value="{$key}">{$unit}</option>
                        {/volist}
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">默认供应商</label>
                <div class="layui-input-inline">
                    <select name="vid" lay-search>
                        <option value="">请选择</option>
                        {volist name="users" id="user"}
                        <option value="{$user.id}">{$user.name}-{$user.phone}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">制造厂商</label>
                <div class="layui-input-inline">
                    <input type="text" name="factory" value="" placeholder="请输入制造厂商" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">序列号</label>
                <div class="layui-input-inline">
                    <input type="radio" name="check_out" value="0" title="不强制" checked>
                    <input type="radio" name="check_out" value="1" title="强制">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">条形码</label>
                <div class="layui-input-inline">
                    <input type="text" name="bar_code" value="" placeholder="请输入制造厂商" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">实际成本</label>
                <div class="layui-input-inline">
                    <input type="text" name="price" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">零售报价</label>
                <div class="layui-input-inline">
                    <input type="text" name="retail_price" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">零售限价</label>
                <div class="layui-input-inline">
                    <input type="text" name="retail_price_limit" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">分销报价</label>
                <div class="layui-input-inline">
                    <input type="text" name="agent_price" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">分销限价</label>
                <div class="layui-input-inline">
                    <input type="text" name="agent_price_limit" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">最大库存量</label>
                <div class="layui-input-inline">
                    <input type="text" name="max_stock" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">最小库存量</label>
                <div class="layui-input-inline">
                    <input type="text" name="min_stock" value="0" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-front-submit" id="LAY-front-submit" value="确认">
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    //JavaScript代码区域
    layui.use(['form', 'treeSelect'], function() {
        var $ = layui.$
            , treeSelect = layui.treeSelect
            , form = layui.form;
        treeSelect.render({
            // 选择器
            elem: '#tree_name',
            // 数据
            data: "{:url('/erp.Basics/add')}?op=getTree",
            // 异步加载方式：get/post，默认get
            type: 'post',
            // 占位符
            placeholder: '请选择物料组',
            // 是否开启搜索功能：true/false，默认false
            search: true,
            // 点击回调
            click: function(d){
                $('#tree_name').val(d.current.id);
            },
            // 加载完成后的回调函数
            success: function (d) {
                // 选中节点，根据id筛选
                //treeSelect.checkNode('tree_name', 1);
            }
        });
    });
</script>
{/block}